<template>
  <div class="hello">
    <h1>{{ currentDate }}</h1><button @click="resetDate()">重置</button>
    <InfiniteDatePicker v-model="currentDate" :options="dateOptions" @change="dateChange"/>
  </div>
</template>

<script>
  import {InfiniteDatePicker} from  '../../packages'
export default {
  name: 'HelloWorld',
  components: {
    InfiniteDatePicker
  },
  props: {
    msg: String
  },
  data () {
    return {
      currentDate: '2021-08-20 11:26',
      dateOptions: {
        step: 5,
        itemHeight: 40,
        formatter: ['YYYY', 'MM', 'DD'],
        type: 'year-month-day',
        active: 'active_err'
      }
    }
  },
  created() {
  },
  methods: {
    resetDate () {
      this.dateOptions.type = 'day-hour-minute'
      this.dateOptions.formatter = ['MM月DD日 ddd', 'HH', 'mm']
      this.currentDate = '2021-08-20 01:00'
    },
    dateChange (date) {
      console.log(date)
    }
  }
}
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
h3 {
  margin: 40px 0 0;
}
ul {
  list-style-type: none;
  padding: 0;
}
li {
  display: inline-block;
  margin: 0 10px;
}
a {
  color: #42b983;
}
</style>
